Skip to content

fix #19, tutorial update pycall (ex10)#21

Merged
Yushan-Wang merged 5 commits intomainfrom
19-tutorial-update-pycall-plugin
Jan 28, 2025
Merged

fix #19, tutorial update pycall (ex10)#21
Yushan-Wang merged 5 commits intomainfrom
19-tutorial-update-pycall-plugin

Conversation

@jmorice91
Copy link
Copy Markdown
Contributor

No description provided.

@jmorice91 jmorice91 self-assigned this Nov 22, 2024
@jmorice91 jmorice91 linked an issue Nov 22, 2024 that may be closed by this pull request
@jmorice91 jmorice91 changed the title fix #19, tutorial update ex10 fix #19, tutorial update pycall (ex10) Nov 22, 2024
Comment thread README.md Outdated
Comment thread ex10.yml Outdated
Comment on lines +24 to +40
#*** the name of the PDI variable to write.
#...
dataset: main_field # name of the dataset in "ex10.h5"
dataset_selection:
size: [1, '$dsize[0]-2', '$dsize[1]-2']
start: ['$ii-1', '$pcoord[0]*($dsize[0]-2)', '$pcoord[1]*($dsize[1]-2)']
#*** load the pycall plugin and enable this plugin for event loop.
#...
#*** Specifies the input parameters (variables) to pass to Python as a set of "$-expressions" (expressions must be defined in .yml script)
#...
#*** add exec keyword of pycall plugin. Decomment and the following python script
#...
# import numpy as np
# if 0 < iter_id < 4: # iter_id: time iteration
# transformed_field = np.sqrt(source_field[1:-1,1:-1])
# pdi.expose('transformed_field', transformed_field, pdi.OUT)
## Comment: The last line allows to expose transformed field to PDI. Hence, the data is known by PDI in this call.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#*** the name of the PDI variable to write.
#...
dataset: main_field # name of the dataset in "ex10.h5"
dataset_selection:
size: [1, '$dsize[0]-2', '$dsize[1]-2']
start: ['$ii-1', '$pcoord[0]*($dsize[0]-2)', '$pcoord[1]*($dsize[1]-2)']
#*** load the pycall plugin and enable this plugin for event loop.
#...
#*** Specifies the input parameters (variables) to pass to Python as a set of "$-expressions" (expressions must be defined in .yml script)
#...
#*** add exec keyword of pycall plugin. Decomment and the following python script
#...
# import numpy as np
# if 0 < iter_id < 4: # iter_id: time iteration
# transformed_field = np.sqrt(source_field[1:-1,1:-1])
# pdi.expose('transformed_field', transformed_field, pdi.OUT)
## Comment: The last line allows to expose transformed field to PDI. Hence, the data is known by PDI in this call.
#*** the name of the PDI variable to write
#...
dataset: main_field # name of the dataset in "ex10.h5"
dataset_selection:
size: [1, '$dsize[0]-2', '$dsize[1]-2']
start: ['$ii-1', '$pcoord[0]*($dsize[0]-2)', '$pcoord[1]*($dsize[1]-2)']
#*** load the pycall plugin and enable this plugin for event loop
#...
#*** specifies the input parameters (variables) to pass to Python as a set of "$-expressions" (expressions must be defined in .yml script)
#...
#*** add exec keyword of pycall plugin. Decomment and the following python script
#...
# import numpy as np
# if 0 < iter_id < 4: # iter_id: time iteration
# transformed_field = np.sqrt(source_field[1:-1,1:-1])
# pdi.expose('transformed_field', transformed_field, pdi.OUT)
## Comment: The last line allows to expose transformed field to PDI. Hence, the data is known by PDI in this call.

Need to unify comment format for all files. As of now, some comments got no uppercase and no end dot, some only get the uppercase (as in ex10.c), and some have both.
Also need to modify to account for solution's indent (transformed_data).

Comment thread solutions/ex10.yml Outdated
Comment thread ex10.c
Comment thread ex10.c
Comment thread README.md
@Yushan-Wang Yushan-Wang merged commit 8d36da1 into main Jan 28, 2025
@Yushan-Wang Yushan-Wang deleted the 19-tutorial-update-pycall-plugin branch January 28, 2025 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tutorial update: pycall plugin

3 participants